using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.ObjectBuilder;
using Microsoft.Practices.CompositeWeb;
using System.Transactions;
using GC2.Entities.Admin;
using GC2.ExceptionHandler.Services;
using GC2.DataAccess.DAAdmin;

namespace GC2.Bussines.BMAdmin
{
    public class BMCheques
    {
        public BMCheques(string coneccion)
        {
            this.Connection = coneccion;
        }

        private string connection = "";
        public string Connection
        {
            get { return connection; }
            set { connection = value; }
        }

        private Cheques oCheques = new Cheques();
        private List<Cheques> listaCheques = new List<Cheques>();
        private DACheques daCheques = new DACheques();

        #region BMChequesInsert
        public void BMChequesInsert(Cheques cheque)
        {
            try
            {
                daCheques.DAChequesInsert(connection, cheque);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMChequesUpdateEstado
        public void BMChequesUpdateEstado(Cheques cheque)
        {
            try
            {
                daCheques.DAChequesUpdateEstado(connection, cheque);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMChequesGetAllByVenta
        public List<Cheques> BMChequesGetAllByVenta(Cheques cheque)
        {
            try
            {
                listaCheques = daCheques.DAChequesGetAllByVenta(connection, cheque);
                return listaCheques;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMChequesGetAllByEstado
        public List<Cheques> BMChequesGetAllByEstado(Cheques chequeD, Cheques chequeH)
        {
            try
            {
                listaCheques = daCheques.DAChequesGetAllByEstado(connection, chequeD, chequeH);
                return listaCheques;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMChequesGetOne
        public Cheques BMChequesGetOne(Cheques cheque)
        {
            try
            {
                oCheques = daCheques.DAChequesGetOne(connection, cheque);
                return oCheques;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMChequesDelete
        public void BMChequesDelete(Cheques cheque)
        {
            try
            {
                daCheques.DAChequesDelete(connection, cheque);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

    }
}
